package baobaotao.resource;

import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.core.io.support.ResourcePatternResolver;

import java.io.IOException;

/**
 * Created by Administrator on 2015/7/21.
 */
public class FileSourceExample {
    public static void main(String[] args) throws IOException {
       /* try {
            String filePath = "E:\\study Materials\\Spring+3.x企业应用开发实战光盘源码\\chapter3\\WebRoot\\WEB-INF\\classes\\conf\\file1.txt";
            Resource res1 = new FileSystemResource(filePath);
//            Resource res2 = new ClassPathResource("/conf/file1.txt");

            InputStream ins1 = res1.getInputStream();
//            InputStream ins2 = res2.getInputStream();
            System.out.println("res1:"+res1.getFilename());
//            System.out.println("res2:"+res2.getFilename());
        } catch (IOException e) {
            e.printStackTrace();
        }*/

        ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
        Resource resources[] = resolver.getResources("classpath*:**/*.xml");
        for (Resource resource : resources) {
            System.out.println(resource.getDescription());
        }


    }
}
